import threading
import traceback
import logging

_logger = logging.getLogger(__name__)


def print_threading_info():
    """ 打印当前线程信息，帮助观察 多线程环境 """

    threadId = threading.current_thread()
    main_threadId = threading.main_thread()
    caller = traceback.extract_stack()
    module = caller[-2][0]
    caller = caller[-2][2]
    _logger.debug(
        "***** %s, %s : main_threadId:%s, threadId: %s *****" % (module, caller, main_threadId.ident, threadId.ident))
